﻿using BBICMS.Core;
using BBICMS.Model.Enums;
using BBICMS.Model.Security;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace BBICMS.Model
{
    public class Category : AuditableEntity<int>
    {
        //public int CategoryId { get; set; }

        [Display(Name = "分类名称")]
        [Required(ErrorMessage = "请输入分类名称")]
        public string Title { get; set; }

        [Display(Name = "排序")]
        [Required(ErrorMessage = "请输入排序")]
        [RegularExpression(@"^-?\d*$", ErrorMessage = "格式不正确")]
        public int Importance { get; set; }

         [Display(Name = "激活")]
        public bool Active { get; set; }

        [Required]
        [Display(Name = "类型", Prompt = "必填")]
        public ModelType ModelType { get; set; }
        public ICollection<Product> Products { get; set; }
        public virtual ICollection<Menu> Menus { get; set; }
        public Category()
        {
            this.Products = new List<Product>();
            this.Menus = new List<Menu>();
        }
    }
}
